Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Protocol tests set their own AWS credentials #1784

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

jbelkins
Copy link
Contributor

@jbelkins jbelkins commented Oct 9, 2024

Description of changes

Companion smithy-swift PR: smithy-lang/smithy-swift#837

Simplifies protocol test config to accompany the changes in smithy-swift. This PR also includes code-generation changes.

  • The four protocol tests that rely on endpoint resolution are updated with codegen from the companion smithy-swift PR.
  • The .xcscheme and .xctestplan for protocol tests are deleted, since they served no purpose other than to facilitate credentials provided through env vars.
  • Code that sets up AWS credential & config files with dummy data is deleted.

New/existing dependencies impact assessment, if applicable

No new dependencies were added to this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jbelkins jbelkins changed the title fix: Protocol tests set their own AWS credentials chore: Protocol tests set their own AWS credentials Oct 9, 2024
@@ -118,7 +118,6 @@ jobs:
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
-scheme aws-sdk-swift-protocol-tests-Package \
-testPlan ProtocolTestPlan \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This protocol test plan is deleted (see below). Its only purpose was to get credentials into Xcode test runs, now this is done in protocol test setup.

run: |
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id = test-key-id" >> ~/.aws/credentials
echo "aws_secret_access_key = test-secret-access-key" >> ~/.aws/credentials
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code above is deleted since credentials are now provided statically at protocol test client creation.

@@ -12,6 +12,7 @@ import ClientRuntime
import Smithy
import SmithyTestUtil
import XCTest
import func SmithyTestUtil.dummyIdentityResolver
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4 tests below demonstrate the code changes to protocol tests.

The SmithyTestUtil.dummyIdentityResolver function provides a static identity resolver with some dummy AWS credentials.

signingRegion: "us-west-2",
idempotencyTokenGenerator: ProtocolTestIdempotencyTokenGenerator(),
httpClientEngine: ProtocolTestClient()
)
let client = S3Client(config: config)

let input = GetObjectInput(
Copy link
Contributor Author

@jbelkins jbelkins Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .xcscheme and .xctestplan files below are deleted because they are unnecessary.

  • The .xctestplan was only used to inject credentials in environment vars, those credentials are now supplied via static identity resolver.
  • The .xcscheme is auto-generated by Xcode on demand, with all targets in the package included. Having a hard-coded .xcscheme makes it necessary to add new tests to the scheme as they are added; this results in skipped tests if not done. Not a problem with the auto-generated scheme since it auto-generates for every test run. The auto-generated scheme has the same name as the now-deleted .xcscheme file, so no change to scheme name where it is referenced.

@jbelkins jbelkins marked this pull request as ready for review October 9, 2024 06:47
@jbelkins jbelkins requested review from dayaffe and sichanyoo October 9, 2024 13:47
@jbelkins jbelkins merged commit 5a7e888 into main Oct 9, 2024
29 checks passed
@jbelkins jbelkins deleted the jbe/protocol_test_creds branch October 9, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants